#include "widget.h"
#include "ui_widget.h"
#include <QTimer>
#include <QDebug>
Widget::Widget(QWidget *parent)
    : QWidget(parent)
    , ui(new Ui::Widget)
{
    ui->setupUi(this);
    timer = new QTimer();
    timer->start(100);//设置100ms周期的持续发送timeout信号

    //设置槽函数，让其实现ProcessBar的递增
    connect(timer,&QTimer::timeout,this,&Widget::handle);
}

Widget::~Widget()
{
    delete ui;
}

void Widget::handle(){
    //1. 获取process的值
    int value = ui->progressBar->value();
    ui->progressBar->setValue(value+1);//每次进来都让其+1
    if(value >= ui->progressBar->maximum()){//若够了
        timer->stop();//停止信号
    }

}

void Widget::on_calendarWidget_selectionChanged()
{
//    qDebug() << ui->calendarWidget->selectedDate();
    QDate date = ui->calendarWidget->selectedDate();
    ui->label->setText(date.toString());
}
